﻿using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace Monkeynaut.iOS
{
	[Register("AppDelegate")]
	public partial class AppDelegate : WaveEngine.Adapter.Application
	{
		private MonkeynautGame _game;

		public override void Initialize ()
		{
			_game = new MonkeynautGame ();
			_game.Initialize (this);
		}

		public override void Update (TimeSpan elapsedTime)
		{
			_game.UpdateFrame (elapsedTime);
		}

		public override void Draw (TimeSpan elapsedTime)
		{
			_game.DrawFrame (elapsedTime);
		}

		public override void OnResignActivation (UIApplication application)
		{
			base.OnResignActivation (application);

			_game.OnDeactivated ();
		}

		public override void OnActivated (UIApplication application)
		{
			if (_game != null) {

				_game.OnActivated ();
			}

			base.OnActivated (application);
		}
	}
}